package com.zcc.controller;

import com.zcc.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
public class IndexController {

    @RequestMapping("/thy")
    public String index(Model model) {
        model.addAttribute("msg", "Hello Spring Boot!");
        return "thy";
    }

    @RequestMapping("/thy1")
    public String thy(Model model) {
        model.addAttribute("msg", "<h1>Hello Spring Boot!<h1>");
        return "thy";
    }

    @RequestMapping("/user")
    public String user(Model model) {
        List<User> users = new ArrayList<User>();
        users.add(new User(1,"zcc1",20));
        users.add(new User(2,"zcc2",20));
        users.add(new User(3,"zcc3",20));
        model.addAttribute("users", users);
        return "thy";
    }
}
